#include <stdio.h>

int main() {
    int num[] = {1, 2, 3, 0, 7, 8, 0, 3, 4, 0, 1, 2, 1};

    int arraynum = sizeof(num) / sizeof(int);

    printf("输入:");
    for (int i = 0; i < arraynum; ++i) 
        printf("%d ", num[i]);
    printf("\n");

    for (int i = 0; i < arraynum; ++i) {
        if (num[i] != 0)
            continue;
        for (int j = i; j < arraynum - 1; ++j) 
            num[j] = num[j + 1];
        num[arraynum - 1] = 0;
    }   
    printf("输出:");
    for (int i = 0; i < arraynum; ++i)
        printf("%d ", num[i]);
    printf("\n");

    return 0;
}